// 对象基本测试
const person = {
    name: "张三",
    age: 30,
    greet: function() {
        return "你好，我是" + this.name;
    }
};

console.log("对象测试:");
console.log(person.name);
console.log(person.age);
console.log(person.greet());

// 对象计算属性测试
const key = "动态键";
const obj = {
    [key]: "动态值",
    ["计算" + "属性"]: 123
};

console.log("\n计算属性测试:");
console.log(obj[key]);
console.log(obj["计算属性"]);

// 类定义测试
class Animal {
    constructor(name) {
        this.name = name;
    }
    
    speak() {
        return this.name + "发出声音";
    }
    
    static info() {
        return "这是Animal类";
    }
}

console.log("\n类测试:");
const animal = new Animal("小动物");
console.log(animal.name);
console.log(animal.speak());
console.log(Animal.info());

// 类继承测试
class Dog extends Animal {
    constructor(name, breed) {
        super(name);
        this.breed = breed;
    }
    
    speak() {
        return this.name + "汪汪叫";
    }
    
    getBreed() {
        return this.breed;
    }
}

console.log("\n继承测试:");
const dog = new Dog("小狗", "哈士奇");
console.log(dog.name);
console.log(dog.breed);
console.log(dog.speak());
console.log(dog.getBreed());
